<?php

/**
 * Auto Code generation
 *
 * @version $Rev:$
 * @license
 */
class Default_Model_Frontend extends Zend_Db_Table_Abstract
{

    public function __construct($config = array())
    {
        $this->_db = Zend_Db_Table::getDefaultAdapter();
        parent::__construct($config);
    }
    public function selectNewTour($limit)
    {
        $select = $this->_db->select()
                            ->from(array('tct'=>'tourist_company_tour'),
                                     array('CODE'=>'code','AVAILABLE'=>'available','CATEGORY'=>'id_tour_category',"ID_TOUR"=> 'id'))
                            ->join(array('td' => 'tour_description'),
                                         'tct.id = td.id_tour',
                                         array('TOUR_NAME'=>'name','IMAGE'=>'images')
                                        )
                            ->join(array('c' => 'company'),
                                         'tct.id_company = c.id',
                                         array('COMPANY_NAME'=>'name')
                                        )
                            ->where('tct.available = ? ',1)
                            ->order(array('tct.id DESC'))
                            ->limit($limit);
        $data = $this->_db->fetchAll($select);
        return $data;
    }

}

